/**
,editoptions:{size:12,dataInit: function(element) {$(element).datepicker({dateFormat: 'yy-mm-dd'})}} 
,formoptions:{elmprefix:'(*)'}
, edittype:'select', editoptions:{value:{1:'One',2:'Two'}}
,editrules:{number:true}
**/
//设备台账（Equipment Accounts)
$(document).ready(function(){	
	$("#list_ea").jqGrid({
		url: '/ajax/ajax_zy_equipment_accounts.php?'+url_obj, //显示的数据
		editurl: '/ajax/ajax_zy_equipment_accounts.php?'+url_obj,
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ["序号(Item)", "设备类别(Type)","财务设备编号(Account No)","设备自编号(Self-No)","设备名称(Name)","规格型号(Specification)","出厂编号(Production No)","制造商(Manufacture)", "合同号(Contract No)","到达日期(Arrive Date)","启用日期(Use Time)","状态(Status)","上次检测日期(Last Check Date)","下次检测日期(Next Check Date)","备注(Remarks)"], //表头标题别名
		colModel: [			
			{name: 'ea_id', index: 'ea_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},			
			{name: 'ea_type', index: 'ea_type', width: 180,fixed:true, align: 'left', sortable:false,editable:true,editoptions:{size:30},editrules:{required:true}},
			{name: 'account_no', index: 'account_no', width: 180,fixed:true, align: 'left', sortable:false,editable:true,editoptions:{size:30},editrules:{required:true}},
			{name: 'ea_slfe_no', index: 'ea_slfe_no', width: 180, sortable:false,editable:true,editoptions:{size:30}},
			{name: 'mc_name', index: 'mc_name', width: 180, sortable:false,editable:true,editoptions:{size:30}},
			{name: 'modle', index: 'modle', width: 180, sortable:false,editable:true,editoptions:{size:30}},
			{name: 'comp_no', index: 'comp_no', width: 180, sortable:false,editable:true,editoptions:{size:30}},
			{name: 'make_comp', index: 'make_comp', width: 130, sortable:false,editable:true,editoptions:{size:30}},
			{name: 'contract_no', index: 'contract_no', width: 130, sortable:false,editable:true,editoptions:{size:30}},			
			{name: 'arrive_date', index: 'arrive_date', width: 140, sortable:false,editable:true,editoptions:{size:30,readonly:true,dataInit: function(element) {$(element).datepicker({dateFormat: 'yy-mm-dd'})}} },
			{name: 'use_time', index: 'use_time', width: 140, sortable:false,editable:true,editoptions:{size:30,readonly:true,dataInit: function(element) {$(element).datepicker({dateFormat: 'yy-mm-dd'})}} },
			{name: 'states', index: 'states', width: 100, sortable:false,editable:true,editoptions:{size:30}},			
			{name: 'last_check_time', index: 'last_check_time', width: 140, sortable:false,editable:true,editoptions:{size:30,readonly:true,dataInit: function(element) {$(element).datepicker({dateFormat: 'yy-mm-dd'})}} },
			{name: 'next_check_time', index: 'next_check_time', width: 140, sortable:false,editable:true,editoptions:{size:30,readonly:true,dataInit: function(element) {$(element).datepicker({dateFormat: 'yy-mm-dd'})}} },			
			{name: 'info', index: 'info', width: 180, align: 'left',search:false, sortable:false,editable:true,edittype: 'textarea',editoptions:{rows:'3',cols:'30'}},
		],
		//postData:{project: global_project, week_time: global_week},
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false,
			id: "ea_id",
			cell: "cell", 
			userdata: "userdata"
		},
		//width: 600,
		height: 350,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_ea'),
		rowNum: 15, //每页显示记录数
		rowList:[15,20,30], //可调整每页显示的记录数
		sortname: 'ea_id',
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_ea").navGrid("#pager_ea", {
			refresh: true,
			edit: false,
			add: true,
			del:true,
			search: false,
			//searchtext:'查找',
			position: "left"
		},{width:450,height:500,reloadAfterSubmit:false,closeOnEscape:true, closeAfterEdit: true}, // edit options
		{width:450,reloadAfterSubmit:true,closeAfterAdd: true}, // add options
		{mtype:"POST",reloadAfterSubmit: true}, // del options
		{multipleSearch:false,closeOnEscape:true,closeAfterSearch: true} // search options	
	);
});